<?php
/**
 * +----------------------------------------------------------------------
 * | 留言模型
 * +----------------------------------------------------------------------
 */
namespace app\common\model;

use think\Model;

class Message extends Model
{
    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

   
	public function getStatusTextAttr($value,$data)
    {
        $status = [0=>'未读',1=>'已读'];
        return $status[$data['status']];
    }

	public function getIpAddressAttr($value,$data)
    {
		$get_info = get_ip_address($data['ip']);

		if($get_info){
			$address = $get_info['country'] . $get_info['city']. $get_info['region']. $get_info['area'] .'【'.$get_info['isp'].'】';
		}else{
			$address = ' -- ';
		}
		
        return $address;
    }


}